<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@page import="com.liuya.safe.model.SafePrivilege" %>
<%@ page import="com.liuya.common.I18N" %>
<%
    I18N i18n = I18N.getInstance();

    SafePrivilege node = (SafePrivilege) request.getAttribute("node");
    String id = node.getId();
    boolean isLeaf = node.getIsLeaf();
    String name = node.getName();
    String description = node.getDescription();

    String assignUserRolePvlgId = SafePrivilege.ASSIGN_ROLE_TO_USER_ID;
%>

<%=isLeaf ? i18n.say("Privilege") : i18n.say("Privilege_group")%> <i><%=name%>
</i>:<p/>

<%if (id != null && Integer.valueOf(id) < -1 && id.equals(assignUserRolePvlgId)) { %>
The reserved node is not editable.
<% } else if (id == assignUserRolePvlgId) { %>
<a href="/priviPolicy/policy.do?oper=editPolicy&id=<%=id %>"><%=i18n.say("Edit_policy") %>
</a>&nbsp;&nbsp;&nbsp;
<a href="/priviPolicy/policy.do?oper=testPolicy&id=<%=id %>"><%=i18n.say("Test") %>
</a>
<% } %>

<%
    if (!isLeaf) {
%>
<a href="javascript:createNode('<%=id%>')"><%=i18n.say("Create") %>
</a>&nbsp;&nbsp;&nbsp;
<% } %>


<%
    if (id != null && Integer.valueOf(id) > 0) {
%>
<a href="javascript:deleteNode('<%=id %>')"><%=i18n.say("Delete") %>
</a>&nbsp;&nbsp;&nbsp;
<a href="javascript:modifyNode('<%=id %>')"><%=i18n.say("Edit") %>
</a>&nbsp;&nbsp;&nbsp;
<%
    }
%>

<%
    if (isLeaf && id != null && Integer.valueOf(id) > 0) {
%>
<a href="/priviPolicy/policy.do?oper=editPolicy&id=<%=id %>"><%=i18n.say("Edit_policy") %>
</a>&nbsp;&nbsp;&nbsp;
<a href="/priviPolicy/policy.do?oper=testPolicy&id=<%=id %>"><%=i18n.say("Test") %>
</a>
<%
    }
%>
